package com.aliyun.messagemgt.common.enums;


/**
 * @author lby
 * @Date 16:48 2019/5/5
 */

public enum JobOperateEnum {
    /**
     *定时任务操作动作枚举
     */
    START(1, "启动"),
    PAUSE(2, "暂停"),
    DELETE(3, "删除");

    private final Integer value;
    private final String desc;

    JobOperateEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return this.value;
    }

    // Jackson 注解为 JsonValue 返回中文 json 描述
    public String getDesc() {
        return this.desc;
    }

    public String getEnumName() {
        return name();
    }

    /**
     * 获取对象实例
     *
     * @param key 键
     * @return
     */
    public static JobOperateEnum valueofKey(Integer key) {
        for (JobOperateEnum jobOperateEnum : values()) {
            if (jobOperateEnum.value.equals(key)) {
                return jobOperateEnum;
            }
        }
        throw new IllegalArgumentException("未查询到匹配实例对象：" + key);
    }
}
